package main

import (
	"fmt"
	"os"
)

func main() {
	file, error := os.Open("/Users/Yohann/go/src/golang-study/day8/src/main/error")
	if error != nil {
		fmt.Println(error) //open /Users/Yohann/go/src/golang-study/day8/src/main/error: no such file or directory
	}
	error = file.Close()
	fmt.Println(error) //invalid argument
}

//自定义错误
type myError struct {
	msg  string
	code int
}

func (e myError) Error() string {
	fmt.Println(e)
	return e.msg
}
